/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved. 
 */
package com.icinfo.cloud.provider.punish.config.service.impl;

import com.icinfo.cloud.provider.common.exception.BusinessException;
import com.icinfo.cloud.provider.punish.config.mapper.ConfigBusiParamDeptMapper;
import com.icinfo.cloud.provider.punish.config.model.ConfigBusiParamDept;
import com.icinfo.cloud.provider.punish.config.service.IConfigBusiParamDeptService;
import com.icinfo.cloud.provider.punish.ucase.casemain.model.CaseHandlePersonRecord;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.CaseHandlePersonRecordVo;
import com.icinfo.framework.core.service.support.MyBatisServiceSupport;
import com.icinfo.framework.mybatis.mapper.entity.Example;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 描述: 部门参数配置表 config_busi_param_dept 对应的Service接口实现类.<br>
 *
 * @author framework generator
 * @date 2022年02月25日
 */
@Service
public class ConfigBusiParamDeptServiceImpl extends MyBatisServiceSupport implements IConfigBusiParamDeptService {
    /**
     * 日志记录器
     */
    private static final Logger logger = LoggerFactory.getLogger(ConfigBusiParamDeptServiceImpl.class);

    @Autowired
    private ConfigBusiParamDeptMapper configBusiParamDeptMapper;

    /**
     * 【V1.0.0】描述：根据部门编码获取部门参数配置详情
     * @author tianrunjia
     * @param deptCode
     * @return
     */
    @Override
    public ConfigBusiParamDept getConfigBusiParamDeptDetailByDeptCode(String deptCode) {
        if(StringUtils.isNotEmpty(deptCode)){
            Example queryExample = new Example(ConfigBusiParamDept.class);
            queryExample.createCriteria().andEqualTo("deptCode",deptCode);
            List<ConfigBusiParamDept> configBusiParamDeptList = configBusiParamDeptMapper.selectByExample(queryExample);
            if(configBusiParamDeptList.size()>0){
                return configBusiParamDeptList.get(0);
            }else {
                throw new BusinessException("部门参数配置信息为空！");
            }
        }else {
            throw new BusinessException("非法传值，部门编码deptCode为空！");
        }
    }
}